<?php
namespace app\admin\model;

use think\Model;
use think\Session;

class Admin extends Model
{
    protected $table = 'admin';
    protected $autoWriteTimestamp = 'datetime';

    public static function do_login($name,$password)
    {

        $admin = Admin::where('name',trim($name))->where('password',md5($password))->find();

        if ($admin){
            Session::set('admin',$admin);
            return true;
        }

        return false;

    }



}